function dateConvert(date) {//传入一个日期类型 剪切
  if (date) {
    return date.replace("T"," ")
  }
  return "null"
}
function req({url, data, success}) {
  var util = require('promisify');
  var request = util(wx.request);
  request({ url, data }).then(res => {
    typeof success == "function" && success(res)
  }).catch(err => { return err })
}

function getPoleInfo({success}) {
  var util = require('promisify');
  var request = util(wx.request);
  request({ 
    url:'http://localhost:8080/accp/psPoleInfo/getPoleInfo',
    data: {
      lineId: 0,
      isStart: 2
    }
 }).then(res => {
   var myFor = [];
   for(var i in res.data){
     myFor.push({
       name: res.data[i].poleCode,
       value: res.data[i].id
     })
   }
   typeof success == "function" && success(myFor)
  }).catch(err=>console.log(err));
}

module.exports={
  dateConvert: dateConvert,
  req: req,
  getPoleInfo: getPoleInfo
}